<template>
  <div class="body">
<!--
    <div class="header">

      <div class="menu">
        <el-menu ref="menu" :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect">
          <el-menu-item index="1">已接收内容</el-menu-item>
          <el-menu-item index="2">学生信息</el-menu-item>
        </el-menu>
      </div>

    </div>-->
    <div class="main">
      <router-view :key="$route.path"></router-view>
    </div>
  </div>

</template>

<script>
  export default {
    name: "uploadPhotosParent",
    data() {
      return {
        activeIndex: '1',

      }
    },
    created() {
      this.activeIndex = this.$route.meta.uploadIndex
    },
    watch: {
      '$route.path': function (n) {
        if (this.$route.meta.uploadIndex) {
          this.$refs.menu.updateActiveIndex(this.$route.meta.uploadIndex)
        }

      }
    },
    methods: {

      handleSelect(index) {
        console.log(this.$refs.menu)
        let workId = this.$route.query.workId
        if (index === '1') {
          this.$router.push({
            path: '/uploadPhotos/parent/uploadPhotos',
            query: {
              workId: workId
            }
          })
        }
        if (index === '2') {
          this.$router.push({
            path: '/uploadPhotos/parent/uploadPhotoUsers',
            query: {
              workId: workId
            }
          })
        }

      }
    }
  }
</script>

<style scoped type="less">
.body {
  //padding: 0 30px;
  height: 100%;
  width: 100%;
  box-sizing: border-box;
  .header {
    height: 61px;
    box-sizing: border-box;
    overflow: hidden;

    .tools {
      width: 50px;
      height: 100%;
      float: left;
      text-align: center;
      line-height: 61px;
      cursor: pointer;
    }
    .menu {
      width: calc(100% - 50px);
      float: left;
    }
  }
  .main {
    height: calc(100%);
    box-sizing: border-box;
  }
}
</style>
